<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户登录-会员中心</title>
    <link rel="stylesheet" href="./fonts/demo.css">
    <link rel="stylesheet" href="./fonts/iconfont.css">
    <link rel="stylesheet" href="./css/login.css">
    <link rel="shortcut icon" href="./image/logo.ico" /> 
    <script src="./js/ajax.js"></script>
    <script src="./js/cookie.js"></script>
</head>
<body>
    <!-- 头部 -->
    <div class="navbar navbar-simple">
        <div class="container">
          <div class="navbar-header">
            <a href="./home.html">
              <img src="https://statics6.casiostore.com.cn/publics/images/pc/casio-new-logo.png" width="160px">
            </a>
          </div>
        </div>
      </div>
    <!-- 登录 -->
    <div class="banner-full">
        <div class="loginbar">
            <div class="control-label">
                <div class="top text-no-select">
                    <ul>
                        <li id="reg"><a href="">动态密码登录</a></li>
                        <li id="log"><a href="">账号登录</a></li>
                    </ul>
                </div>
                <div id="log_div" class="control-right">
                    <i class="iconfont">&#xe603;</i>
                    <input type="phone" name="phone" placeholder="请输入手机号码/邮箱">
                </div>
                <div id="log_div" class="control-right">
                    <i class="iconfont">&#xe61a;</i>
                    <input type="password" name="password" placeholder="请输入密码">
                </div>
                <button class="button">登录</button>
                <a href="./register.html">我要注册</a>
                <a href="">忘记密码?</a>
                <div class="list-oauth">
                    <span></span>
                    <ul>
                        <li class="icon-oauth icon-image">
                            <a href="">
                                <img src="https://statics6.casiostore.com.cn/publics/images/pc/icon/reg-weibo-color.png">
                            </a>
                        </li>
                        <li class="icon-oauth icon-image">
                            <a href="">
                                <img src="https://statics6.casiostore.com.cn/publics/images/pc/icon/reg-wechat-color.png">
                            </a>
                        </li>
                        <li class="icon-oauth icon-image">
                            <a href="">
                                <img src="https://statics6.casiostore.com.cn/publics/images/pc/icon/reg-alipay-color.png">
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <!-- 尾部 -->
    <div class="panel panel-footer-simple">
        <div class="panel-body">
            <p>
                <a href="./home.html">C's Club</a>
                &nbsp;&nbsp;|&nbsp;&nbsp;
                <a href="">帮助中心</a>
                &nbsp;&nbsp;|&nbsp;
                <a href="">
                    <i class="iconfont">&#xe631;</i>在线客服
                </a>
                <span>
                    <i class="iconfont">&#xe604;</i>400-700-6655&nbsp;(周一至周日&nbsp;9:00-21:00)
                </span>
            </p>
            <p class="keep-on-record">
                <a href="">卡西欧官方商城</a>
                <span>
                    <a href=""> 京ICP备 10009123号-10</a>
                </span>
            </p>
        </div>
    </div>
</body>
<script>
    document.querySelector('.button').onclick = function(){
    var phone = document.querySelector('[name="phone"]').value
    var password = document.querySelector('[name="password"]').value
    if(phone === ''){
        alert('用户名不能为空')
        return false;
    }
    if(password === ''){
        alert('密码不能为空')
        return false;
    }
    sendAjax({
        url:"./php/login.php",
        method:"post",
        data:{
            phone,
            password
        },
        //对象简写
        success(res){
            // res=JSON.parse(res)
            var {meta:{status,message}}=res;
            alert(message)
            if(status===1){
                sCookie('phone',phone,5000)
                location.href = "home.html"
            }
        },
        dataType:"json"
    })
}
</script>
</html>